import Vue from 'vue'
import App from './App.vue'
import router from './router'
import singleSpaVUe from 'single-spa-vue'

Vue.config.productionTip = false

const appOptions = {
  el: '#vue', // 挂载到父应用中的id为vue的标签中
  router,
  render: h => h(app)
}

// 返回bootstrap mount unmount
const vueLifeCycle =  singleSpaVUe({
  vue,
  appOptions
})

// 协议接入， 定义好协议， 父应用调用这些方法
export const bootstrap = vueLifeCycle.bootstrap
export const mount = vueLifeCycle.mount
export const unmount = vueLifeCycle.unmount

// 需要把父应用加载子应用，将1子应用打包成一个个的lib去给父应用使用
// vue.config.js

// 如应用引用了
if (window.singleSpaNavigate) {
  _webpack_public_path_ = 'http://localhost:10000/'
}
// 非子应用可正常启动
if (!window.singleSpaNavigate) {
  delete appOptions.el
  new Vue(appOptions).$mount('#app')
}
// new Vue({
//   router,
//   render: h => h(App)
// }).$mount('#app')
